<%--
  Created by IntelliJ IDEA.
  User: 林锴
  Date: 2018/3/18
  Time: 22:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
    <title>个人信息</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/common.css" media="all">
    <script src="${pageContext.request.contextPath}/static/jquery/jquery-1.12.4.js"></script>
    <script src="${pageContext.request.contextPath}/static/css/layui/layui.js"></script>
</head>
<body>
    <form class="layui-form" action="${pageContext.request.contextPath}/worker/modifyInfo">
        <input type="hidden" readonly name="id" value="${worker.id}">
        <div class="info_form_body">
            <div class="layui-form-item">
                <label class="layui-form-label">工号:</label>
                <div class="layui-input-block">
                    <input id="workerId" readonly type="text" name="workerId" value="${worker.workerId}"  lay-verify="required" placeholder="工号" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">姓名:</label>
                <div class="layui-input-block">
                    <input type="text"  name="name" value="${worker.name}" lay-verify="name" placeholder="姓名" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">性别:</label>
                <input id="sex" value="${worker.sex}" type="hidden">
                <div class="layui-input-block">
                    <input type="radio" name="sex" value="男" title="男">
                    <input type="radio" name="sex" value="女" title="女">
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">入职时间:</label>
                <div class="layui-input-block">
                    <input id="inDate" readonly type="text"  name="inDate"  lay-verify="date" value="<fmt:formatDate value="${worker.inDate}" type="date" pattern="yyyy-MM-dd"/>" lay-verify="required" placeholder="入职时间" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">联系电话:</label>
                <div class="layui-input-block">
                    <input id="phone" type="text" lay-verify="required|phone" name="phone" value="${worker.phone}" lay-verify="required" placeholder="联系电话" autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button lay-submit="" lay-filter="check" class="layui-btn">修改信息</button>
                </div>
            </div>
        </div>
    </form>

<script>
    var sex=$('#sex').val();
    var csex=sex=='男'?'女':'男';
    $("input:radio[name='sex'][value="+sex+"]").prop("checked","true");
    $("input:radio[name='sex'][value="+csex+"]").prop("disabled","true");
    layui.use(['form', 'layedit', 'laydate'],function () {
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit;

        form.verify({
            name:function (value) {
                if(value==""){
                    return '姓名不能为空';
                }
            }
        });

        form.on('submit(check)', function(data){
            return true;
        });


    });


</script>

</body>
</html>
